using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._SpatialStatisticsTools._ModelingSpatialRelationships
{
    /// <summary>
    /// <para>Forest-based Classification and Regression</para>
    /// <para>Creates models and generates predictions using an adaptation of Leo Breiman's random forest algorithm, which is a supervised machine learning method. Predictions can be performed for both categorical variables (classification) and continuous variables (regression). Explanatory variables can take the form of fields in the attribute table of the training features, raster datasets, and distance features used to calculate proximity values for use as additional variables. In addition to validation of model performance based on the training data, predictions can be made to either features or a prediction raster.</para>
    /// <para>使用 Leo Breiman 的随机森林算法（一种监督式机器学习方法）的改编来创建模型并生成预测。可以对分类变量（分类）和连续变量（回归）执行预测。解释变量可以采用训练要素属性表、栅格数据集和距离要素中的字段形式，用于计算邻近值以用作附加变量。除了基于训练数据验证模型性能外，还可以对要素或预测栅格进行预测。</para>
    /// </summary>    
    [DisplayName("Forest-based Classification and Regression")]
    public class Forest : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public Forest()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_prediction_type">
        /// <para>Prediction Type</para>
        /// <para><xdoc>
        ///   <para>Specifies the operation mode of the tool. The tool can be run to train a model to only assess performance, predict features, or create a prediction surface.</para>
        ///   <bulletList>
        ///     <bullet_item>Train only—A model will be trained, but no predictions will be generated. Use this option to assess the accuracy of your model before generating predictions. This option will output model diagnostics in the messages window and a chart of variable importance. This is the default</bullet_item><para/>
        ///     <bullet_item>Predict to features—Predictions or classifications will be generated for features. Explanatory variables must be provided for both the training features and the features to be predicted. The output of this option will be a feature class, model diagnostics in the messages window, and an optional table and chart of variable importance.</bullet_item><para/>
        ///     <bullet_item>Predict to raster—A prediction raster will be generated for the area where the explanatory rasters intersect. Explanatory rasters must be provided for both the training area and the area to be predicted. The output of this option will be a prediction surface, model diagnostics in the messages window, and an optional table and chart of variable importance.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定工具的操作模式。可以运行该工具来训练模型，使其仅评估性能、预测特征或创建预测表面。</para>
        ///   <bulletList>
        ///     <bullet_item>仅训练—将训练模型，但不会生成预测。在生成预测之前，使用此选项可以评估模型的准确性。此选项将在消息窗口中输出模型诊断和具有可变重要性的图表。这是默认设置</bullet_item><para/>
        ///     <bullet_item>预测要素—将为要素生成预测或分类。必须为训练特征和要预测的特征提供解释变量。此选项的输出将是一个要素类、消息窗口中的模型诊断，以及一个具有可变重要性的可选表和图表。</bullet_item><para/>
        ///     <bullet_item>预测到栅格—将为解释性栅格相交的区域生成预测栅格。必须为训练区域和要预测的区域提供解释栅格。此选项的输出将是预测图面、消息窗口中的模型诊断以及具有可变重要性的可选表和图表。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// </param>
        /// <param name="_in_features">
        /// <para>Input Training Features</para>
        /// <para>The feature class containing the Variable to Predict parameter and, optionally, the explanatory training variables from fields.</para>
        /// <para>包含要预测的变量参数和字段中的解释性训练变量（可选）的要素类。</para>
        /// </param>
        public Forest(_prediction_type_value _prediction_type, object _in_features)
        {
            this._prediction_type = _prediction_type;
            this._in_features = _in_features;
        }
        public override string ToolboxName => "Spatial Statistics Tools";

        public override string ToolName => "Forest-based Classification and Regression";

        public override string CallName => "stats.Forest";

        public override List<string> AcceptEnvironments => ["cellSize", "mask", "outputCoordinateSystem", "parallelProcessingFactor", "randomGenerator"];

        public override object[] ParameterInfo => [_prediction_type.GetGPValue(), _in_features, _variable_predict, _treat_variable_as_categorical.GetGPValue(), _explanatory_variables, _distance_features, _explanatory_rasters, _features_to_predict, _output_features, _output_raster, _explanatory_variable_matching, _explanatory_distance_matching, _explanatory_rasters_matching, _output_trained_features, _output_importance_table, _use_raster_values.GetGPValue(), _number_of_trees, _minimum_leaf_size, _maximum_depth, _sample_size, _random_variables, _percentage_for_training, _output_classification_table, _output_validation_table, _compensate_sparse_categories.GetGPValue(), _number_validation_runs, _calculate_uncertainty.GetGPValue(), _output_uncertainty_raster_layers];

        /// <summary>
        /// <para>Prediction Type</para>
        /// <para><xdoc>
        ///   <para>Specifies the operation mode of the tool. The tool can be run to train a model to only assess performance, predict features, or create a prediction surface.</para>
        ///   <bulletList>
        ///     <bullet_item>Train only—A model will be trained, but no predictions will be generated. Use this option to assess the accuracy of your model before generating predictions. This option will output model diagnostics in the messages window and a chart of variable importance. This is the default</bullet_item><para/>
        ///     <bullet_item>Predict to features—Predictions or classifications will be generated for features. Explanatory variables must be provided for both the training features and the features to be predicted. The output of this option will be a feature class, model diagnostics in the messages window, and an optional table and chart of variable importance.</bullet_item><para/>
        ///     <bullet_item>Predict to raster—A prediction raster will be generated for the area where the explanatory rasters intersect. Explanatory rasters must be provided for both the training area and the area to be predicted. The output of this option will be a prediction surface, model diagnostics in the messages window, and an optional table and chart of variable importance.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定工具的操作模式。可以运行该工具来训练模型，使其仅评估性能、预测特征或创建预测表面。</para>
        ///   <bulletList>
        ///     <bullet_item>仅训练—将训练模型，但不会生成预测。在生成预测之前，使用此选项可以评估模型的准确性。此选项将在消息窗口中输出模型诊断和具有可变重要性的图表。这是默认设置</bullet_item><para/>
        ///     <bullet_item>预测要素—将为要素生成预测或分类。必须为训练特征和要预测的特征提供解释变量。此选项的输出将是一个要素类、消息窗口中的模型诊断，以及一个具有可变重要性的可选表和图表。</bullet_item><para/>
        ///     <bullet_item>预测到栅格—将为解释性栅格相交的区域生成预测栅格。必须为训练区域和要预测的区域提供解释栅格。此选项的输出将是预测图面、消息窗口中的模型诊断以及具有可变重要性的可选表和图表。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Prediction Type")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public _prediction_type_value _prediction_type { get; set; }

        public enum _prediction_type_value
        {
            /// <summary>
            /// <para>Train only</para>
            /// <para>Train only—A model will be trained, but no predictions will be generated. Use this option to assess the accuracy of your model before generating predictions. This option will output model diagnostics in the messages window and a chart of variable importance. This is the default</para>
            /// <para>仅训练—将训练模型，但不会生成预测。在生成预测之前，使用此选项可以评估模型的准确性。此选项将在消息窗口中输出模型诊断和具有可变重要性的图表。这是默认设置</para>
            /// </summary>
            [Description("Train only")]
            [GPEnumValue("TRAIN")]
            _TRAIN,

            /// <summary>
            /// <para>Predict to features</para>
            /// <para>Predict to features—Predictions or classifications will be generated for features. Explanatory variables must be provided for both the training features and the features to be predicted. The output of this option will be a feature class, model diagnostics in the messages window, and an optional table and chart of variable importance.</para>
            /// <para>预测要素—将为要素生成预测或分类。必须为训练特征和要预测的特征提供解释变量。此选项的输出将是一个要素类、消息窗口中的模型诊断，以及一个具有可变重要性的可选表和图表。</para>
            /// </summary>
            [Description("Predict to features")]
            [GPEnumValue("PREDICT_FEATURES")]
            _PREDICT_FEATURES,

            /// <summary>
            /// <para>Predict to raster</para>
            /// <para>Predict to raster—A prediction raster will be generated for the area where the explanatory rasters intersect. Explanatory rasters must be provided for both the training area and the area to be predicted. The output of this option will be a prediction surface, model diagnostics in the messages window, and an optional table and chart of variable importance.</para>
            /// <para>预测到栅格—将为解释性栅格相交的区域生成预测栅格。必须为训练区域和要预测的区域提供解释栅格。此选项的输出将是预测图面、消息窗口中的模型诊断以及具有可变重要性的可选表和图表。</para>
            /// </summary>
            [Description("Predict to raster")]
            [GPEnumValue("PREDICT_RASTER")]
            _PREDICT_RASTER,

        }

        /// <summary>
        /// <para>Input Training Features</para>
        /// <para>The feature class containing the Variable to Predict parameter and, optionally, the explanatory training variables from fields.</para>
        /// <para>包含要预测的变量参数和字段中的解释性训练变量（可选）的要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Training Features")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_features { get; set; }


        /// <summary>
        /// <para>Variable to Predict</para>
        /// <para>The variable from the Input Training Features parameter containing the values to be used to train the model. This field contains known (training) values of the variable that will be used to predict at unknown locations.</para>
        /// <para>输入训练特征参数中的变量，包含用于训练模型的值。此字段包含变量的已知（训练）值，这些值将用于在未知位置进行预测。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Variable to Predict")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _variable_predict { get; set; } = null;


        /// <summary>
        /// <para>Treat Variable as Categorical</para>
        /// <para><xdoc>
        ///   <para>Specifies whether the Variable to Predict is a categorical variable.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—The Variable to Predict is a categorical variable and the tool will perform classification.</bullet_item><para/>
        ///     <bullet_item>Unchecked—The Variable to Predict is continuous and the tool will perform regression. This is the default.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定要预测的变量是否为分类变量。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 要预测的变量是分类变量，工具将执行分类。</bullet_item><para/>
        ///     <bullet_item>未选中 - 要预测的变量是连续的，工具将执行回归。这是默认设置。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Treat Variable as Categorical")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _treat_variable_as_categorical_value? _treat_variable_as_categorical { get; set; } = null;

        public enum _treat_variable_as_categorical_value
        {
            /// <summary>
            /// <para>CATEGORICAL</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("CATEGORICAL")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NUMERIC</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NUMERIC")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Explanatory Training Variables</para>
        /// <para>A list of fields representing the explanatory variables that help predict the value or category of the Variable to Predict. Check the Categorical check box for any variables that represent classes or categories (such as land cover or presence or absence).</para>
        /// <para>表示解释变量的字段列表，这些变量有助于预测要预测的变量的值或类别。选中表示类或类别（例如土地覆被或存在或不存在）的任何变量的分类复选框。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Explanatory Training Variables")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _explanatory_variables { get; set; } = null;


        /// <summary>
        /// <para>Explanatory Training Distance Features</para>
        /// <para>Automatically creates explanatory variables by calculating a distance from the provided features to the Input Training Features. Distances will be calculated from each of the input Explanatory Training Distance Features to the nearest Input Training Features. If the input Explanatory Training Distance Features are polygons or lines, the distance attributes are calculated as the distance between the closest segments of the pair of features.</para>
        /// <para>通过计算从提供的要素到输入训练要素的距离来自动创建解释变量。将从每个输入解释性训练距离要素到最近的输入训练要素计算距离。如果输入说明训练距离要素为面或线，则距离属性的计算为要素对最近线段之间的距离。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Explanatory Training Distance Features")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public List<object> _distance_features { get; set; } = null;


        /// <summary>
        /// <para>Explanatory Training Rasters</para>
        /// <para>Automatically creates explanatory training variables in your model whose values are extracted from rasters. For each feature in the Input Training Features, the value of the raster cell is extracted at that exact location. Bilinear raster resampling is used when extracting the raster value for continuous rasters. Nearest neighbor assignment is used when extracting a raster value from categorical rasters. Check the Categorical check box for any rasters that represent classes or categories such as land cover or presence or absence.</para>
        /// <para>在模型中自动创建解释性训练变量，其值是从栅格中提取的。对于输入训练要素中的每个要素，栅格像元的值将在该确切位置提取。提取连续栅格的栅格值时，将使用双线性栅格重采样。从分类栅格中提取栅格值时，将使用最近邻分配。选中表示类或类别（例如土地覆被或存在或不存在）的任何栅格的分类复选框。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Explanatory Training Rasters")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _explanatory_rasters { get; set; } = null;


        /// <summary>
        /// <para>Input Prediction Features</para>
        /// <para>A feature class representing locations where predictions will be made. This feature class must also contain any explanatory variables provided as fields that correspond to those used from the training data if any.</para>
        /// <para>表示将进行预测的位置的要素类。此要素类还必须包含作为字段提供的任何解释变量，这些变量与训练数据中使用的变量（如果有）相对应。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Prediction Features")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _features_to_predict { get; set; } = null;


        /// <summary>
        /// <para>Output Predicted Features</para>
        /// <para>The output feature class to receive the results of the prediction results.</para>
        /// <para>用于接收预测结果结果的输出要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Predicted Features")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _output_features { get; set; } = null;


        /// <summary>
        /// <para>Output Prediction Surface</para>
        /// <para>The output raster containing the prediction results. The default cell size will be the maximum cell size of the raster inputs. To set a different cell size, use the cell size environment setting.</para>
        /// <para>包含预测结果的输出栅格。默认像元大小将为栅格输入的最大像元大小。要设置不同的像元大小，请使用像元大小环境设置。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Prediction Surface")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _output_raster { get; set; } = null;


        /// <summary>
        /// <para>Match Explanatory Variables</para>
        /// <para>A list of the Explanatory Variables specified from the Input Training Features on the right and their corresponding fields from the Input Prediction Features on the left.</para>
        /// <para>从右侧的输入训练要素中指定的解释变量列表，以及从左侧的输入预测要素中指定的相应字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Match Explanatory Variables")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _explanatory_variable_matching { get; set; } = null;


        /// <summary>
        /// <para>Match Distance Features</para>
        /// <para><xdoc>
        ///   <para>A list of the Explanatory Distance Features specified for the Input Training Features on the right. Corresponding feature sets should be specified for the Input Prediction Features on the left.</para>
        ///   <para>Explanatory Distance Features that are more appropriate for the Input Prediction Features can be provided if those used for training are in a different study area or time period.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>为右侧输入训练要素指定的解释性距离要素列表。应为左侧的输入预测要素指定相应的要素集。</para>
        ///   <para>如果用于训练的解释距离要素位于不同的研究区域或时间段，则可以提供更适合输入预测要素的解释性距离要素。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Match Distance Features")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _explanatory_distance_matching { get; set; } = null;


        /// <summary>
        /// <para>Match Explanatory Rasters</para>
        /// <para><xdoc>
        ///   <para>A list of the Explanatory Rasters specified for the Input Training Features on the right. Corresponding rasters should be specified for the Input Prediction Features or the Prediction Surface to be created on the left.</para>
        ///   <para>Explanatory Rasters that are more appropriate for the Input Prediction Features can be provided if those used for training are in a different study area or time period.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>为右侧输入训练要素指定的解释性栅格列表。应为左侧要创建的输入预测要素或预测表面指定相应的栅格。</para>
        ///   <para>如果用于训练的解释栅格位于不同的研究区域或时间段，则可以提供更适合输入预测要素的解释性栅格。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Match Explanatory Rasters")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _explanatory_rasters_matching { get; set; } = null;


        /// <summary>
        /// <para>Output Trained Features</para>
        /// <para>Output Trained Features will contain all explanatory variables used for training (including sampled raster values and distance calculations), as well as the observed Variable to Predict field and accompanying predictions that can be used to further assess performance of the trained model.</para>
        /// <para>输出训练要素将包含用于训练的所有解释变量（包括采样栅格值和距离计算），以及观测到的要预测的变量字段和随附的预测，可用于进一步评估训练模型的性能。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Trained Features")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _output_trained_features { get; set; } = null;


        /// <summary>
        /// <para>Output Variable Importance Table</para>
        /// <para>If specified, the table will contain information describing the importance of each explanatory variable (fields, distance features, and rasters) used in the model created. The chart created from this table can be accessed in the Contents pane.</para>
        /// <para>如果指定，该表将包含描述所创建模型中使用的每个解释变量（字段、距离要素和栅格）重要性的信息。根据此表创建的图表可在内容窗格中访问。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Variable Importance Table")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _output_importance_table { get; set; } = null;


        /// <summary>
        /// <para>Convert Polygons to Raster Resolution for Training</para>
        /// <para><xdoc>
        ///   <para>Specifies how polygons are treated when training the model if the Input Training Features are polygons with a categorical Variable to Predict and only Explanatory Training Rasters have been specified.
        ///   <bulletList>
        ///     <bullet_item>Checked—The polygon is divided into all of the raster cells with centroids falling within the polygon. The raster values at each centroid are then extracted and used to train the model. The model is no longer trained on the polygon itself, but rather the model is trained on the raster values extracted for each cell centroid. This is the default.  </bullet_item><para/>
        ///     <bullet_item>Unchecked—Each polygon is assigned the average value of the underlying continuous rasters and the majority for underlying categorical rasters.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>指定如果输入训练要素是具有要预测的分类变量的面，并且仅指定了解释性训练栅格，则指定在训练模型时如何处理面。
        ///   <bulletList>
        ///     <bullet_item>选中 - 将面划分为所有栅格像元，质心位于面内。然后提取每个质心处的栅格值并用于训练模型。模型不再在面本身上进行训练，而是根据为每个像元质心提取的栅格值进行训练。这是默认设置。 </bullet_item><para/>
        ///     <bullet_item>未选中 - 为每个面分配基础连续栅格的平均值和基础分类栅格的大多数值。</bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Convert Polygons to Raster Resolution for Training")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _use_raster_values_value _use_raster_values { get; set; } = _use_raster_values_value._true;

        public enum _use_raster_values_value
        {
            /// <summary>
            /// <para>TRUE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("TRUE")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>FALSE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("FALSE")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Number of Trees</para>
        /// <para>The number of trees to create in the forest model. More trees will generally result in more accurate model prediction, but the model will take longer to calculate. The default number of trees is 100.</para>
        /// <para>要在森林模型中创建的树数。更多的树通常会导致更准确的模型预测，但模型需要更长的时间来计算。默认树数为 100。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Number of Trees")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _number_of_trees { get; set; } = 100;


        /// <summary>
        /// <para>Minimum Leaf Size</para>
        /// <para>The minimum number of observations required to keep a leaf (that is the terminal node on a tree without further splits). The default minimum for regression is 5 and the default for classification is 1. For very large data, increasing these numbers will decrease the run time of the tool.</para>
        /// <para>保留叶（即树上的终端节点，没有进一步拆分）所需的最小观测值数。回归的默认最小值为 5，分类的默认值为 1。对于非常大的数据，增加这些数字将减少工具的运行时间。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Minimum Leaf Size")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long? _minimum_leaf_size { get; set; } = null;


        /// <summary>
        /// <para>Maximum Tree Depth</para>
        /// <para>The maximum number of splits that will be made down a tree. Using a large maximum depth, more splits will be created, which may increase the chances of overfitting the model. The default is data driven and depends on the number of trees created and the number of variables included.</para>
        /// <para>将沿着树进行的最大拆分数。使用较大的最大深度，将创建更多的分割，这可能会增加模型过度拟合的机会。默认值是数据驱动的，取决于创建的树数和包含的变量数。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Maximum Tree Depth")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long? _maximum_depth { get; set; } = null;


        /// <summary>
        /// <para>Data Available per Tree (%)</para>
        /// <para><xdoc>
        ///   <para>Specifies the percentage of the Input Training Features used for each decision tree. The default is 100 percent of the data. Samples for each tree are taken randomly from two-thirds of the data specified.</para>
        ///   <para>Each decision tree in the forest is created using a random sample or subset (approximately two-thirds) of the training data available. Using a lower percentage of the input data for each decision tree increases the speed of the tool for very large datasets.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定用于每个决策树的输入训练特征的百分比。默认值为 100% 的数据。每棵树的样本是从指定数据的三分之二中随机抽取的。</para>
        ///   <para>森林中的每个决策树都是使用可用训练数据的随机样本或子集（大约三分之二）创建的。对每个决策树使用较低百分比的输入数据可提高工具处理超大型数据集的速度。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Data Available per Tree (%)")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _sample_size { get; set; } = 100;


        /// <summary>
        /// <para>Number of Randomly Sampled Variables</para>
        /// <para><xdoc>
        ///   <para>Specifies the number of explanatory variables used to create each decision tree.</para>
        ///   <para>Each of the decision trees in the forest is created using a random subset of the explanatory variables specified. Increasing the number of variables used in each decision tree will increase the chances of overfitting your model particularly if there is one or more dominant variables. A common practice is to use the square root of the total number of explanatory variables (fields, distances, and rasters combined) if your Variable to Predict is numeric or divide the total number of explanatory variables (fields, distances, and rasters combined) by 3 if Variable to Predict is categorical.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定用于创建每个决策树的解释变量数。</para>
        ///   <para>林中的每个决策树都是使用指定的解释变量的随机子集创建的。增加每个决策树中使用的变量数量将增加模型过度拟合的机会，尤其是在存在一个或多个主导变量的情况下。通常的做法是，如果要预测的变量为数值，则使用解释变量（字段、距离和栅格组合）总数的平方根，如果要预测的变量是分类变量，则将解释变量（字段、距离和栅格的总和）的总数除以 3。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Number of Randomly Sampled Variables")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long? _random_variables { get; set; } = null;


        /// <summary>
        /// <para>Training Data Excluded for Validation (%)</para>
        /// <para>Specifies the percentage (between 10 percent and 50 percent) of Input Training Features to reserve as the test dataset for validation. The model will be trained without this random subset of data, and the observed values for those features will be compared to the predicted values. The default is 10 percent.</para>
        /// <para>指定要保留为验证测试数据集的输入训练要素的百分比（介于 10% 和 50% 之间）。模型将在没有此随机数据子集的情况下进行训练，并将这些特征的观测值与预测值进行比较。默认值为 10%。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Training Data Excluded for Validation (%)")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _percentage_for_training { get; set; } = 10;


        /// <summary>
        /// <para>Output Classification Performance Table (Confusion Matrix)</para>
        /// <para>If specified, creates a confusion matrix for classification summarizing the performance of the model created. This table can be used to calculate other diagnostics beyond the accuracy and sensitivity measures the tool calculates in the output messages.</para>
        /// <para>如果指定，则创建一个用于分类的混淆矩阵，总结所创建模型的性能。此表可用于计算工具在输出消息中计算的准确性和灵敏度测量值之外的其他诊断。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Classification Performance Table (Confusion Matrix)")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _output_classification_table { get; set; } = null;


        /// <summary>
        /// <para>Output  Validation Table</para>
        /// <para>If the Number of Runs for Validation specified is greater than 2, this table creates a chart of the distribution of R2 for each model. This distribution can be used to assess the stability of your model.</para>
        /// <para>如果指定的“验证运行次数”大于 2，则此表将创建每个模型的 R2 分布图。此分布可用于评估模型的稳定性。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output  Validation Table")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _output_validation_table { get; set; } = null;


        /// <summary>
        /// <para>Compensate for Sparse Categories</para>
        /// <para><xdoc>
        ///   <para>If there are categories in your dataset that don't occur as often as others, checking this parameter will ensure that each category is represented in each tree.
        ///   <bulletList>
        ///     <bullet_item>Checked—Each tree will include every category that is represented in the training dataset.  </bullet_item><para/>
        ///     <bullet_item>Unchecked—Each tree will be created based on a random sample of the categories in the training dataset. This is the default.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>如果数据集中的某些类别不像其他类别那样频繁出现，则选中此参数将确保每个类别都表示在每个树中。
        ///   <bulletList>
        ///     <bullet_item>选中 - 每棵树将包括训练数据集中表示的每个类别。</bullet_item><para/>
        ///     <bullet_item>未选中 - 将根据训练数据集中类别的随机样本创建每个树。这是默认设置。 </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Compensate for Sparse Categories")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _compensate_sparse_categories_value? _compensate_sparse_categories { get; set; } = null;

        public enum _compensate_sparse_categories_value
        {
            /// <summary>
            /// <para>TRUE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("TRUE")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>FALSE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("FALSE")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Number of Runs for Validation</para>
        /// <para>The tool will run for the number of iterations specified. The distribution of the R2 for each run can be displayed using the Output Validation Table parameter. When this is set and predictions are being generated, only the model that produced the highest R2 value will be used for predictions.</para>
        /// <para>该工具将按指定的迭代次数运行。可以使用输出验证表参数显示每次运行的 R2 分布。设置此值并生成预测时，仅将生成最高 R2 值的模型用于预测。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Number of Runs for Validation")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _number_validation_runs { get; set; } = 1;


        /// <summary>
        /// <para>Calculate Uncertainty</para>
        /// <para><xdoc>
        ///   <para>Specifies whether prediction uncertainty will be calculated when training, predicting to features, or predicting to raster.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—A prediction uncertainty interval will be calculated.</bullet_item><para/>
        ///     <bullet_item>Unchecked—Uncertainty will not be calculated. This is the default.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定在训练、预测要素或预测栅格时是否计算预测不确定性。</para>
        ///   <bulletList>
        ///     <bullet_item>选中—将计算预测不确定度区间。</bullet_item><para/>
        ///     <bullet_item>未选中—不计算不确定性。这是默认设置。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Calculate Uncertainty")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _calculate_uncertainty_value _calculate_uncertainty { get; set; } = _calculate_uncertainty_value._false;

        public enum _calculate_uncertainty_value
        {
            /// <summary>
            /// <para>TRUE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("TRUE")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>FALSE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("FALSE")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Output Uncertainty Raster Layers</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Uncertainty Raster Layers")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public List<object> _output_uncertainty_raster_layers { get; set; }


        public Forest SetEnv(object cellSize = null, object mask = null, object outputCoordinateSystem = null, object parallelProcessingFactor = null, object randomGenerator = null)
        {
            base.SetEnv(cellSize: cellSize, mask: mask, outputCoordinateSystem: outputCoordinateSystem, parallelProcessingFactor: parallelProcessingFactor, randomGenerator: randomGenerator);
            return this;
        }

    }

}